﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LNUGame.Model
{
    /// <summary>
    /// Base represention of a menu
    /// </summary>
    class MenuModel
    {
        public enum MenuOption
        {
            START_GAME = 0,
            CONTROLS = 1,
            EXIT_GAME = 2,
            DISPLAY_CONTROLS = 3,
            BACK = 4
        }

        protected MenuOption m_selectedOption;
        protected MenuOption[] m_options;

        protected MenuOption m_firstMenuOption;
        protected MenuOption m_lastMenuOption;

        /// <summary>
        /// Getter for the currently selected option
        /// </summary>
        public MenuOption SelectedOption
        {
            get
            {
                return m_selectedOption;
            }
        }


        /// <summary>
        /// Getter for all available options in the menu
        /// </summary>
        public MenuOption[] MenuOptions
        {
            get
            {
                return m_options;
            }
        }


        /// <summary>
        /// Moves the current selection down one step. If the selection is the first option on the menu, selects the last option
        /// </summary>
        internal void MoveSelectionUp()
        {
            if (m_selectedOption == m_firstMenuOption)
            {
                m_selectedOption = m_lastMenuOption;
            }
            else
            {
                m_selectedOption--;
            }
        }


        /// <summary>
        /// Moves the current selection down one step. If the selection is the last option on the menu, selects the first option
        /// </summary>
        internal void MoveSelectionDown()
        {
            if (m_selectedOption == m_lastMenuOption)
            {
                m_selectedOption = m_firstMenuOption;
            }
            else
            {
                m_selectedOption++;
            }
        }


        /// <summary>
        /// Exits the game
        /// </summary>
        public void ExitGame()
        {
            LNUGame.Program.ExitGame();
        }
    }
}
